package com.example.mapper.Dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.domain.entity.Dept;
import com.example.mapper.DeptMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
@Primary
public class DeptDao extends BaseDao<Dept, DeptMapper> implements DeptMapper{
    @Autowired
    private DeptMapper deptMapper;

    @Override
    protected BaseMapper<Dept> getMapper() {
        return deptMapper;
    }


    @Override
    public String getDeptName(Integer id) {
        Dept dept = this.selectById(id);
        if(dept == null) {
            return null;
        }
        return dept.getDeptName();
    }
}
